import cv2
from pyzbar.pyzbar import decode
import os

dir_path = 'C:\\Users\\zhanghao\\Desktop\\tmp\\imgOut'

# 获取当前目录下的所有文件
files = [os.path.join(dir_path, file) for file in os.listdir(dir_path)]

# 遍历文件列表，输出文件名
for file in files:
    print(file)
    img = cv2.imread(file)
    data = decode(img)
    print(data[0].data.decode())


# 读取二维码图片
# img = cv2.imread("C:\\Users\\zhanghao\\Desktop\\tmp\\img\\100.jpg")

# 解析二维码
# data = decode(img)

# 打印解析结果
# print(data[0].data.decode())